package com.battle.service.controller.web;

import com.battle.pojo.param.trainingUserDetails.*;
import com.battle.pojo.vo.trainingUserDetails.*;
import com.battle.service.service.in.*;
import nirvana.core.domains.vo.PageResult;
import nirvana.core.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

import java.util.List;

/**
*   web/我的训练-项目记录
* 【描 述】：
* 【环 境】：J2SE
* 【详 细】：
*
*/
@RestController
@RequestMapping("/trainingUserDetails/web")
public class TrainingUserDetailsWebController {

private final TrainingUserDetailsService service;

public TrainingUserDetailsWebController(TrainingUserDetailsService service) {
this.service = service;
}


/**
* 创建我的训练-项目记录
* @param param
* @return
*/
@PostMapping("/createTrainingUserDetails")
public ApiResult createTrainingUserDetails(@RequestBody @Valid CreateTrainingUserDetailsParam param){
service.createTrainingUserDetails(param);
return ApiResult.ok();
}


/**
* 修改我的训练-项目记录
* @param param
*/
@PutMapping("/editTrainingUserDetails")
public ApiResult editTrainingUserDetails(@RequestBody @Valid EditTrainingUserDetailsParam param){
service.editTrainingUserDetails(param);
return ApiResult.ok();
}

/**
* 移除我的训练-项目记录
* @param id
*/
@DeleteMapping("/removeTrainingUserDetails")
public ApiResult removeTrainingUserDetails(@RequestParam("id") Long id){
service.removeTrainingUserDetails(id);
return ApiResult.ok();
}

/**
* 启动/禁用我的训练-项目记录
* @param id
*/
@GetMapping("/enabledTrainingUserDetails")
public ApiResult enabledTrainingUserDetails(@RequestParam("id") Long id){
service.enabledTrainingUserDetails(id);
return ApiResult.ok();
}

/**
* 获取我的训练-项目记录详情
* @param id
* @return
*/
@GetMapping("/getTrainingUserDetails")
public ApiResult< GetTrainingUserDetailsVo> getTrainingUserDetails(@RequestParam("id") Long id){
GetTrainingUserDetailsVo vo = service.getTrainingUserDetails(id);
return ApiResult.ok(vo);
}

/**
* 获取我的训练-项目记录列表
* @param param
* @return
*/
@PostMapping("/getTrainingUserDetailsList")
public ApiResult< PageResult< GetTrainingUserDetailsListVo>> getTrainingUserDetailsList(@RequestBody GetTrainingUserDetailsListParam param){
PageResult< GetTrainingUserDetailsListVo> result = service.getTrainingUserDetailsList(param);
return ApiResult.ok(result);
}


/**
* 获取我的训练-项目记录下拉列表
*
* @return
*/
@PostMapping("/getTrainingUserDetailsDownList")
public ApiResult< List< GetTrainingUserDetailsDownListVo > > getTrainingUserDetailsDownList(@RequestBody(required = false) @Valid GetTrainingUserDetailsDownListParam param) {
List< GetTrainingUserDetailsDownListVo > list = service.getTrainingUserDetailsDownList(param);
return ApiResult.ok(list);
}


}

